package com.ojoin.trade.common_core.web.dao.impl;

import com.ojoin.trade.common.exception.DaoException;
import org.springframework.stereotype.Repository;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.web.dao.impl.BaseDaoImpl;
import com.ojoin.trade.common_core.web.dao.TbMerchantInfoCheckDao;
import com.ojoin.trade.common_core.web.domain.TbMerchantInfo;
import com.ojoin.trade.common_core.web.domain.TbMerchantInfoCheck;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 15-11-16
 * Time: 下午6:25
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class TbMerchantInfoCheckDaoImpl extends BaseDaoImpl<TbMerchantInfoCheck> implements TbMerchantInfoCheckDao {

    @Override
    public int updateCheckFlagByJoinuserId(TbMerchantInfoCheck vo) throws BusinessException {
        String mapMethodName = "updateCheckFlagByJoinuserId";
        try {
             return sqlSessionTemplate.update(
                    getSqlName(mapMethodName),
                    vo);
        } catch (Exception e) {
            throw new DaoException(String.format("更新对象列表出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public  TbMerchantInfoCheck selectByJoinuserId(int joinuserid) throws BusinessException {
        String mapMethodName = "selectByJoinuserId";
        try {
           return sqlSessionTemplate.selectOne(
                    getSqlName(mapMethodName),
                    joinuserid);
        } catch (Exception e) {
            throw new DaoException(String.format("查询对象出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public void deleteByJoinuserId(int joinuserid) throws BusinessException {
        String mapMethodName = "deleteByJoinuserId";
        try {
        	sqlSessionTemplate.delete(getSqlName(mapMethodName), joinuserid);
        } catch (Exception e) {
            throw new DaoException(String.format("删除对象出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

}
